{$contents}

{literal}
<div style="text-align:left; padding:10px;">
<h2>DomFgSL</h2>

<pre>
$$post = DomFgPost::getInstance('${gridName}')->store('${gridName}', array('search') );
$$query = ${className}::query()->orderBy('t.name DESC');
			
if( $$_GET['delete'] && $$item = ${className}::load( $$_GET['delete'] )){
	$$item->delete();
}

if( $$post->search ) {
	$$query->where('name LIKE \'%'.addslashes($$post->search).'%\'');
}
		
$$panel = array(
	'title' => '${title}',
	'layout' => 'table',
	'layoutConfig' => array(
		'columns' => 4,
		'columnWidths' => array(150,60,220),
	),
	'link' => $$this->getUrl('${function_container}/'),
	'items' => array(
		array(
			'type' => 'button',
			'title' => 'Lisa uus',
			'link' => $$this->getUrl('${manageMethod}/'),
		),
		array(
			'type' => 'textField',
			'value' => $$post->search,
			'name' => 'search',
			'title' => 'Otsi',
		),
		array(
			'type' => 'button',
			'title' => 'Otsi',
			'name' => 'doSearch',
		),
		array(
			'type' => 'grid',
			'name' => '${gridName}',
			'pagerResetPostVar' => 'doSearch',
			'source' => new DomArDataSource( $$query, 40, ${gridName} ),
			'colspan' => 4,
			'fields' => array(
				array('key' => 'name', 'title' => 'Nimi'),
				array('type' => 'gridButton', 'value' => 'Muuda', 'link' => $$this->getUrl('${manageMethod}/'), 'title' => 'Valikud','colspan' => 2),
				array('type' => 'gridButton', 'value' => 'Kustuta', 'link' =>$$this->getUrl('${function_container}/&delete='), 'confirmMessage' => 'Are you sure?' ),
			),
		),
	),
);
		
$$this->view->contents = DomFg::render( $$panel );

</pre>
</div>
{/literal}